<template>
<!-- <el-button type="primary">按钮</el-button>-->
<!--  走马灯-->
  <div class="block text-center">
<!--    <span class="demonstration">Switch when indicator is hovered (default)</span>-->
    <el-carousel height="100vh" >
      <el-carousel-item v-for="item in carouseData" :key="item">
        <img style="height: 100vh" class="small justify-center" :src="item.url"/>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>
<script setup>

import {onMounted, ref} from "vue";
import request from "../../../../front_admin/src/utils/request";

const onload=()=>{
    request.get('/slides/page',{
      params: {
        pageNum: 1,
        pageSize: 10,
        title: ''
      },
    }).then(res => {
      if(res.code === '200') {
        // let arr=[]
        let imgList = res.data.list
        imgList.map((item)=>{
          carouseData.value.push({url:item.img})
        })
        // console.log(arr)
        // carouseData.value=arr
      }
    })
}
onMounted(()=>{
  onload()
})
//初始化一个空数组
const carouseData = ref([])


</script>

<style scoped>
.demonstration {
  color: var(--el-text-color-secondary);
}

.el-carousel__item h3 {
  color: #475669;
  opacity: 0.75;
  line-height: 150px;
  margin: 0;
  text-align: center;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
</style>